﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ApprovedRequests.aspx.cs" Inherits="Operator_ApprovedRequests" MasterPageFile="~/Site.master" %>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<br/>
    <asp:HyperLink ID="OperatorLink1" runat="server" NavigateUrl="~/Operator/OperatorPanel.aspx">Панель оператора</asp:HyperLink>
&nbsp;<span class="Apple-style-span" 
                    style="color: rgb(105, 105, 105); font-family: 'Helvetica Neue', 'Lucida Grande', 'Segoe UI', Arial, Helvetica, Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; ">→
                </span>
    <b><asp:Label ID="ApprovedLabel" runat="server" ForeColor="black" Text="Заявки на оформление контрактов"></asp:Label></b>
    <br/>
<br />
 <asp:GridView ID="RequestListGridView" runat="server" 
                    AutoGenerateColumns="False" DataSourceID="SqlDataSource1" 
        onselectedindexchanged="RequestListGridView_SelectedIndexChanged" 
        DataKeyNames="CreditRequestId" 
        onrowdeleting="RequestListGridView_RowDeleting" 
        ondatabinding="RequestListGridView_DataBinding">
                    <Columns>
                        <asp:CommandField SelectText="Рассмотреть" ShowSelectButton="True" />
                        <asp:BoundField DataField="CompanyName" HeaderText="Название предприятия" 
                            SortExpression="CompanyName" />
                        <asp:BoundField DataField="Name" HeaderText="Кредит" SortExpression="Name" />
                        <asp:BoundField DataField="Amount" HeaderText="Сумма" 
                            SortExpression="Amount" />
                        <asp:BoundField DataField="Expr1" HeaderText="Валюта" SortExpression="Expr1" />
                        <asp:BoundField DataField="TermLength" HeaderText="Срок" 
                            SortExpression="TermLength" />
                        <asp:BoundField DataField="CreditRequestId" HeaderText="CreditRequestId" 
                            InsertVisible="False" ReadOnly="True" SortExpression="CreditRequestId" 
                            Visible="False" />
                        <asp:BoundField DataField="MeetingDate" HeaderText="Время встречи" />
                        <asp:CommandField DeleteText="Удалить" ShowDeleteButton="True" />
                    </Columns>
                    <EmptyDataTemplate>
                        Заявок нет.
                    </EmptyDataTemplate>
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>" 
        
        SelectCommand="SELECT Credit.Name, CreditRequest.Amount, CreditRequest.TermLength, Currency.Name AS Expr1, CreditRequest.CreditRequestId, Company.CompanyName, CreditRequest.MeetingDate FROM CreditRequest INNER JOIN Credit ON CreditRequest.CreditId = Credit.CreditID INNER JOIN Currency ON CreditRequest.CurrencyId = Currency.CurrencyID INNER JOIN UserProfile ON CreditRequest.UserProfileId = UserProfile.ProfileId INNER JOIN Company ON UserProfile.CompanyId = Company.CompanyId GROUP BY Credit.Name, CreditRequest.Amount, CreditRequest.TermLength, Currency.Name, CreditRequest.CreditRequestId, CreditRequest.OperatorId, CreditRequest.RequestStatusId, Company.CompanyName, CreditRequest.MeetingDate HAVING (CreditRequest.RequestStatusId = 1) AND (CreditRequest.OperatorId = @OperatorId)" 
        DeleteCommand="DELETE FROM CreditRequest WHERE CreditRequestId = @CreditRequestId"
        >
        <DeleteParameters>
        <asp:Parameter Name="CreditRequestId" />
        </DeleteParameters>
                    <SelectParameters>
                        <asp:Parameter Name="OperatorId" />
                    </SelectParameters>
                </asp:SqlDataSource>
</asp:Content>